package adapter

import "fmt"

type Duck interface {
	Quack()
	Fly()
}

type Turkey interface {
	Gobble()
	Fly()
}

type MallardDuck struct {
}

func (a *MallardDuck) Quack() {
	fmt.Println("Quack")
}

func (a *MallardDuck) Fly() {
	fmt.Println("I'm flying")
}

type WildTurkey struct {
}

func (a *WildTurkey) Gobble() {
	fmt.Println("Gobble gobble")
}

func (a *WildTurkey) Fly() {
	fmt.Println("I'm flying a short distance")
}

type TurkeyAdapter struct {
	turkey Turkey
}

func NewTurkeyAdapter(t Turkey) *TurkeyAdapter {
	r := new(TurkeyAdapter)
	r.turkey = t

	return r
}

func (a *TurkeyAdapter) Quack() {
	a.turkey.Gobble()
}

func (a *TurkeyAdapter) Fly() {
	a.turkey.Fly()
}
